package eoeProject.edenOfEast.page.logoutPage.component;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.Panel;

import eoeProject.edenOfEast.core.EOEAuthenticatedWebSession;


//@AuthorizeInstantiation("ADMIN")
public class LogoutPanel extends Panel {
	private static final long serialVersionUID = 1L;

	private Form<Void> form = new Form<Void>("form");

    public LogoutPanel(String id) {
    	super(id);
    	form.add(submitButton);
    	add(form);
    	EOEAuthenticatedWebSession.get().signOut();

    }

    private AjaxButton submitButton = new AjaxButton("submit"){
		/**
		 *
		 */
		private static final long serialVersionUID = -2942520388218435030L;

		@SuppressWarnings("rawtypes")
		@Override
		protected void onSubmit(AjaxRequestTarget target, Form form){
			setResponsePage(new eoeProject.edenOfEast.page.topPage.Index());
		}

		@Override
		protected void onError(AjaxRequestTarget ajaxrequesttarget,
				Form<?> form1) {
		}



	};


}
